<style>
    .layui-form-label {
        width: 80px !important;
    }

    .layui-input-block {
        margin-left: 120px;
    }

    .hover {
        cursor: pointer;
    }

    .el-input__inner {
        line-height: 30px !important;
        height: 30px !important;
    }
</style>
<div class="rc-pagepadding ">
    <div class=" rc-pannel rc-pagepadding">
        <div class=" rc-pannel-header rc-pagepadding rc-bold">
            <i class="iconfont goback rc-pointer">&#xe62b;</i> 编辑消息通道
        </div>
        <div class="rc-pannel-body layui-form  rc-pagepadding">
            <div class="layui-form-item">
                <label class="layui-form-label">通道名</label>
                <div class="layui-input-block">
                    <input type="input" name="title" id="title" value="<?php echo $channelinfo['title'] ?>" lay-verify="required" class="layui-input">
                </div>

            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">发送扩展</label>
                <div class="layui-input-block">
                    <input type="text" name="extend" id="extend" lay-verify='required' autocomplete="off" value="" class="layui-input" title="" />
                </div>

            </div>

            <div class="layui-form-item rc-margin-bottom0">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-submit lay-filter="submit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-sm">重置</button>
                </div>
            </div>
        </div>
    </div>
    <script src="/static/admin/lib/layui/modules/cascader/cascader.js"></script>
    <script>
        layui.use(function() {
            var form = layui.form;
            var layCascader = layui.layCascader;
            var el_cascader;

            el_cascader = layCascader({
                elem: '#extend',
                filterable: true,
                clearable: true,
                options: $.parseJSON('<?php echo $extends ?>'),
                value: '<?php echo $channelinfo['extendid'] ?>_<?php echo $channelinfo['methodid'] ?>',
                props: {
                    value: 'cascaderid',
                    label: 'title',
                }
            });

            form.on('submit(submit)', function(data) {
                $.ajax({
                    url: '/admin/cnf/Message/editChannel?id=<?php echo request()->get('id') ?>', //请求路径
                    type: "POST", //请求方式
                    data: data.field, // 默认写法
                    success: function(data) {
                        if (data.code == 0) {
                            toastr_success("编辑成功", function() {
                                window.location.href = '/admin/cnf/Message/channels';
                            });

                        } else {
                            toastr_error(data.message);
                        }
                    },
                    error: function() {

                    },

                });
            });

        });
    </script>